package com.bestcem.xm.ticket.service.dto.ticket.rule;

import com.bestcem.xm.ticket.constant.ColumnConstant;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * TicketRule 实体文件迁移出来的
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/9/15 15:58
 */
@Data
public class ValueEntityDTO implements Serializable {

    private static final long serialVersionUID = 3009249907724017412L;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NAIRE_OPTIONS)
    private List<NaireOptions> naireOptions;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.OPTION_LIST)
    private List<Object> optionList;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.EVALUATION_TYPE)
    private Integer evaluationType;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.OPTION_MATCH)
    private String optionMatch;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.WORD_LIST)
    private List<String> wordList;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.EXCLUDE_LIST)
    private List<String> excludeList;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.IS_OPEN)
    private Boolean isOpen;


    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.CLASSIFY)
    private Options classify;

    /**
     * 过期时间。单位秒s
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.EXPIRE)
    private Long expire;

    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.SORT)
    private Integer sort;

    /**
     * 时间类型的题目携带字段
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.TIME)
    private List<String> time;

    /**
     * 分数类型最小分数
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.MIN_SCORE)
    private Integer minScore;

    /**
     * 分数类型最大分数
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.MAX_SCORE)
    private Integer maxScore;

    /**
     * 过期天数
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.DAYS)
    private Integer days;

    /**
     * 分数类型最小分数边界
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.LEFT_OPEN)
    private Boolean leftOpen;

    /**
     * 分数类型最大分数边界
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.RIGHT_OPEN)
    private Boolean rightOpen;

    /**
     * 日期类型的题目携带字段
     */
    @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.DATE)
    private List<String> date;

    /**
     * 前端参数
     */
    @JsonProperty(value = "again_d_t")
    private String againDt;
    /**
     * 前端参数
     */
    @JsonProperty(value = "type")
    private Integer type;
    /**
     * 前端参数
     */
    @JsonProperty(value = "raw_project_id")
    private String rawProjectId;
    /**
     * 前端参数
     */
    @JsonProperty(value = "deliver_project_id")
    private String deliverProjectId;
    /**
     * 前端参数
     */
    @JsonProperty(value = "qtype")
    private String qType;

    @Data
    public static class NaireOptions implements Serializable {

        private static final long serialVersionUID = 7538401871864647832L;
        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.OPTIONS)
        private List<Options> options;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.TYPE)
        private String type;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions._ID)
        private String id;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.GID)
        private String gid;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.OID)
        private Integer oid;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.TITLE)
        private String title;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.OPEN_ATTRS)
        private OpenAttrs openAttrs;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.IS_OPEN)
        private Boolean isOpen;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Value.NaireOptions.SEQ)
        private Integer seq;
    }

    @Data
    public static class Options implements Serializable {


        private static final long serialVersionUID = -1906602054871127902L;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.GID)
        private String gid;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.TYPE)
        private String type;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.SEQ)
        private Integer seq;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.OID)
        private Integer oid;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.TITLE)
        private String title;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.DISABLED)
        private Boolean disabled;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.IS_OPEN)
        private Boolean open;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.Options.OPEN_ATTRS)
        private OpenAttrs openAttrs;
    }

    @Data
    public static class OpenAttrs implements Serializable {

        private static final long serialVersionUID = -2597076114782255953L;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.SourceQ.Item.OpenAttrs.REQUIRED)
        private Boolean required;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.SourceQ.Item.OpenAttrs.TYPE)
        private Integer type;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.SourceQ.Item.OpenAttrs.RANGE)
        private List<String> range;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.SourceQ.Item.OpenAttrs.UNIQUE)
        private String unique;

        @JsonProperty(value = ColumnConstant.TicketRule.Condition.Filter.SourceQ.Item.OpenAttrs.UNIT)
        private String unit;
    }
}
